package com.vrland.web.front.config;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class VrProperties {

	private static final Properties props;

	public static final String CONFIG_ROOT_DIR = "/var/lib/vrland/";
	public static final String ENV_FILE = "env.properties";

	public static final String SPRING_PROFILE = "spring.profiles.active";
	public static final String HIBERNATE_AUTO_DDL = "hibernate.hbm2ddl.auto";
	public static final String JDBC_URL = "vrland.jdbc.url";
	public static final String JDBC_USERNAME = "vrland.jdbc.username";
	public static final String JDBC_PASSWORD = "vrland.jdbc.password";
	public static final String JDBC_DRIVERNAME = "vrland.jdbc.drivername";

	public static String getProperty(String key) {
		return props.getProperty(key);
	}

	static {
		props = new Properties();
		try (InputStream in = new FileInputStream(VrProperties.CONFIG_ROOT_DIR
				+ VrProperties.ENV_FILE)) {
			props.load(in);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
}
